<script setup lang="ts">
import { Button as VanButton } from 'vant'
import { useUserStore } from '../stores'
import { request } from '../utils/request';
import type { User } from '../types/user';
const store = useUserStore()
//测试请求拦截器
const getuser=async()=>{
  const res=await request('/patient/myUser')
  console.log(res);
}
// getuser()
const login=async()=>{
  const res=await request<User>('/login/password','POST',{
    mobile: '13211112222',
    // 密码 abc123456 测试：出现非10000的情况
    password: 'abc12345'
  })
  store.setUser(res.data);
}
login()

</script>

<template>
  <van-button>按钮</van-button>
  <van-button type="primary">按钮</van-button>
  <p>{{ store.user }}</p>
  <button @click="store.setUser({ id: '1', mobile: '1', account: '1', avatar: '1', token: '1' })">
    登录
  </button>
  <button @click="store.delUser()">退出</button>
</template>

<style scoped>

</style>
